package com.heather.exam.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.heather.exam.pojo.table.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface RegisterMapper extends BaseMapper<User> {

    @Select("SELECT * FROM user WHERE email = #{email}")
    Integer selectOneByEmail(@Param("email") String email);

    // 使用MyBatis-Plus的insert方法插入用户数据，由于主键id通常会自动生成（如数据库设置为auto_increment），无需传入
    int insert(User user);
}
